package cn.janus.component;

import cn.janus.pojo.entity.Bill;
import cn.janus.service.IBillService;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(
        topic = "your-topic",
        consumerGroup = "my-consumer-group",
        selectorExpression = "*",
        consumeMode = ConsumeMode.CONCURRENTLY,
        messageModel = MessageModel.BROADCASTING)
public class OrderlyConsumer implements RocketMQListener<Bill> {
    @Autowired
    private IBillService iBillService;

    @Override
    public void onMessage(Bill bill) {
        iBillService.updateById(bill);
    }
}
